/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pl;

import bl.AttendanceBO;
import bl.LaborBO;
import common.Common;
import entities.Attendance;
import entities.Labor;
import java.util.Date;
import javax.swing.JOptionPane;

/**
 *
 * @author Sony
 */
public class LaborPanel extends javax.swing.JPanel {

    private Labor labor = new Labor();
    private LaborBO laborBO = new LaborBO();
    private Attendance attendance = new Attendance();
    private AttendanceBO atBO = new AttendanceBO();
    private Common common = new Common();

    /**
     * Creates new form LaborPanel
     */
    public LaborPanel() {

        initComponents();
        laborBO.addComboBox(cmbSalaryGrade);
        atBO.addComboBox(cmbShift);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jpnLeft = new javax.swing.JPanel();
        lblLaborID = new javax.swing.JLabel();
        lblName = new javax.swing.JLabel();
        lblAddress = new javax.swing.JLabel();
        lblPhone = new javax.swing.JLabel();
        lblGender = new javax.swing.JLabel();
        lblWeight = new javax.swing.JLabel();
        lblHeight = new javax.swing.JLabel();
        lblPersonRefer = new javax.swing.JLabel();
        txtPersonRefer = new javax.swing.JTextField();
        txtHeight = new javax.swing.JTextField();
        lblm = new javax.swing.JLabel();
        txtWeight = new javax.swing.JTextField();
        lblKg = new javax.swing.JLabel();
        rbnMale = new javax.swing.JRadioButton();
        txtPhone = new javax.swing.JTextField();
        txtAddress = new javax.swing.JTextField();
        txtName = new javax.swing.JTextField();
        txtLaborID = new javax.swing.JTextField();
        lblStatus = new javax.swing.JLabel();
        txtStatus = new javax.swing.JTextField();
        lblExperience = new javax.swing.JLabel();
        txtExperience = new javax.swing.JTextField();
        lblPermanent = new javax.swing.JLabel();
        cbxPermanent = new javax.swing.JCheckBox();
        lblSalaryGrade = new javax.swing.JLabel();
        cmbSalaryGrade = new javax.swing.JComboBox();
        lblExtraShift = new javax.swing.JLabel();
        txtExtraShift = new javax.swing.JTextField();
        lblHour = new javax.swing.JLabel();
        lblStartDate = new javax.swing.JLabel();
        jdcStartDate = new com.toedter.calendar.JDateChooser();
        lblEndDate = new javax.swing.JLabel();
        jdcEndDate = new com.toedter.calendar.JDateChooser();
        lblShift = new javax.swing.JLabel();
        cmbShift = new javax.swing.JComboBox();
        btnSalaryDetail = new javax.swing.JButton();
        btnShiftDetail = new javax.swing.JButton();
        jpnRight = new javax.swing.JPanel();
        btnInsert = new javax.swing.JButton();
        btnReset = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        txtBuilding = new javax.swing.JTextArea();
        jScrollPane1 = new javax.swing.JScrollPane();
        txtFamilyDetail = new javax.swing.JTextArea();
        btnView = new javax.swing.JButton();

        setBorder(javax.swing.BorderFactory.createTitledBorder(null, "INFORMATION LABOR", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Times New Roman", 0, 12))); // NOI18N
        setName("jbnMain"); // NOI18N

        jpnLeft.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        lblLaborID.setText("Labor ID:");

        lblName.setText("Name:");

        lblAddress.setText("Address:");

        lblPhone.setText("Phone:");

        lblGender.setText("Gender:");

        lblWeight.setText("Weight:");

        lblHeight.setText("Height:");

        lblPersonRefer.setText("PersonRefer:");

        txtPersonRefer.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        txtHeight.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        lblm.setText("m");

        txtWeight.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        lblKg.setText("Kg");

        rbnMale.setText("Male");
        rbnMale.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        txtPhone.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        txtAddress.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        txtName.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        txtLaborID.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        lblStatus.setText("Status:");

        txtStatus.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        lblExperience.setText("Experience:");

        txtExperience.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        lblPermanent.setText("Permanent:");

        cbxPermanent.setText("        ");
        cbxPermanent.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        lblSalaryGrade.setText("Salary Grade:");

        cmbSalaryGrade.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));

        lblExtraShift.setText("Extra Shift:");

        txtExtraShift.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        lblHour.setText("hour");

        lblStartDate.setText("Start Date:");

        jdcStartDate.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        lblEndDate.setText("End Date:");

        jdcEndDate.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        lblShift.setText("Shift:");

        btnSalaryDetail.setText("Salary Detail");
        btnSalaryDetail.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSalaryDetailActionPerformed(evt);
            }
        });

        btnShiftDetail.setText("Shift Detail");
        btnShiftDetail.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnShiftDetailActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jpnLeftLayout = new javax.swing.GroupLayout(jpnLeft);
        jpnLeft.setLayout(jpnLeftLayout);
        jpnLeftLayout.setHorizontalGroup(
            jpnLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpnLeftLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jpnLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jpnLeftLayout.createSequentialGroup()
                        .addGroup(jpnLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblPersonRefer)
                            .addComponent(lblHeight)
                            .addComponent(lblWeight)
                            .addComponent(lblGender)
                            .addComponent(lblPhone)
                            .addComponent(lblName)
                            .addComponent(lblLaborID))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(jpnLeftLayout.createSequentialGroup()
                        .addGroup(jpnLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jpnLeftLayout.createSequentialGroup()
                                .addGroup(jpnLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(lblExperience)
                                    .addComponent(lblStatus)
                                    .addComponent(lblAddress))
                                .addGap(21, 21, 21)
                                .addGroup(jpnLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(txtAddress, javax.swing.GroupLayout.PREFERRED_SIZE, 227, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(txtExperience, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(txtStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 185, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGroup(jpnLeftLayout.createSequentialGroup()
                                        .addComponent(txtHeight, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(lblm))
                                    .addGroup(jpnLeftLayout.createSequentialGroup()
                                        .addComponent(txtWeight, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(lblKg))
                                    .addComponent(rbnMale)
                                    .addComponent(txtPhone, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(txtName, javax.swing.GroupLayout.PREFERRED_SIZE, 191, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(txtLaborID, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGroup(jpnLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                        .addComponent(btnSalaryDetail)
                                        .addComponent(txtPersonRefer, javax.swing.GroupLayout.PREFERRED_SIZE, 192, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(btnShiftDetail, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE))))
                            .addGroup(jpnLeftLayout.createSequentialGroup()
                                .addComponent(lblPermanent)
                                .addGap(21, 21, 21)
                                .addComponent(cbxPermanent))
                            .addGroup(jpnLeftLayout.createSequentialGroup()
                                .addComponent(lblExtraShift)
                                .addGap(18, 18, 18)
                                .addComponent(txtExtraShift, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(24, 24, 24)
                                .addComponent(lblHour))
                            .addGroup(jpnLeftLayout.createSequentialGroup()
                                .addGroup(jpnLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(lblStartDate)
                                    .addComponent(lblEndDate))
                                .addGap(18, 18, 18)
                                .addGroup(jpnLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jdcEndDate, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jdcStartDate, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(jpnLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jpnLeftLayout.createSequentialGroup()
                                    .addComponent(lblShift)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(cmbShift, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jpnLeftLayout.createSequentialGroup()
                                    .addComponent(lblSalaryGrade)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(cmbSalaryGrade, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addGap(0, 84, Short.MAX_VALUE))))
        );
        jpnLeftLayout.setVerticalGroup(
            jpnLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpnLeftLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jpnLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblLaborID)
                    .addComponent(txtLaborID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jpnLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblName)
                    .addComponent(txtName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jpnLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblAddress)
                    .addComponent(txtAddress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jpnLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblPhone)
                    .addComponent(txtPhone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jpnLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblGender)
                    .addComponent(rbnMale))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jpnLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblWeight)
                    .addComponent(txtWeight, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblKg))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jpnLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtHeight, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblm)
                    .addComponent(lblHeight))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jpnLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblPersonRefer)
                    .addComponent(txtPersonRefer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jpnLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblStatus)
                    .addComponent(txtStatus, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jpnLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblExperience)
                    .addComponent(txtExperience, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jpnLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblPermanent)
                    .addComponent(cbxPermanent))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jpnLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblSalaryGrade)
                    .addComponent(cmbSalaryGrade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnSalaryDetail))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jpnLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblShift)
                    .addComponent(cmbShift, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnShiftDetail))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jpnLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblExtraShift)
                    .addComponent(txtExtraShift, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblHour))
                .addGroup(jpnLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jpnLeftLayout.createSequentialGroup()
                        .addGap(16, 16, 16)
                        .addComponent(lblStartDate))
                    .addGroup(jpnLeftLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jdcStartDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(28, 28, 28)
                .addGroup(jpnLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblEndDate)
                    .addComponent(jdcEndDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(28, Short.MAX_VALUE))
        );

        btnInsert.setText("Insert ");
        btnInsert.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnInsertActionPerformed(evt);
            }
        });

        btnReset.setText("Reset");
        btnReset.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnResetActionPerformed(evt);
            }
        });

        txtBuilding.setColumns(20);
        txtBuilding.setRows(5);
        txtBuilding.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Building"));
        jScrollPane2.setViewportView(txtBuilding);

        txtFamilyDetail.setColumns(20);
        txtFamilyDetail.setRows(5);
        txtFamilyDetail.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Family Detail"));
        jScrollPane1.setViewportView(txtFamilyDetail);

        btnView.setText("View");
        btnView.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnViewActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jpnRightLayout = new javax.swing.GroupLayout(jpnRight);
        jpnRight.setLayout(jpnRightLayout);
        jpnRightLayout.setHorizontalGroup(
            jpnRightLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpnRightLayout.createSequentialGroup()
                .addGroup(jpnRightLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 397, Short.MAX_VALUE)
                    .addComponent(jScrollPane1)
                    .addGroup(jpnRightLayout.createSequentialGroup()
                        .addComponent(btnInsert, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btnReset, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btnView, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jpnRightLayout.setVerticalGroup(
            jpnRightLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jpnRightLayout.createSequentialGroup()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 164, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jpnRightLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(btnInsert, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnView, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btnReset, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(98, 98, 98))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jpnLeft, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jpnRight, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jpnRight, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jpnLeft, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
    }// </editor-fold>//GEN-END:initComponents

    private void btnViewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnViewActionPerformed
        // TODO add your handling code here:
        TableLaborDialog tblLaborDialog = new TableLaborDialog(null, true);
        tblLaborDialog.setVisible(true);
    }//GEN-LAST:event_btnViewActionPerformed

    private void btnInsertActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnInsertActionPerformed
        // TODO add your handling code here:

        labor.setLaborID(txtLaborID.getText());
        labor.setAddress(txtAddress.getText());
        labor.setBuilding(txtBuilding.getText());
        labor.setExperience(txtExperience.getText());
        labor.setFamilyDetail(txtFamilyDetail.getText());
        labor.setGender(rbnMale.isSelected());
        labor.setHeight(txtHeight.getText());
        labor.setName(txtName.getText());
        labor.setPermanent(cbxPermanent.isSelected());
        labor.setPersonRefer(txtPersonRefer.getText());
        labor.setPhoneNumber(Integer.parseInt(txtPhone.getText()));
        labor.setStatus(txtStatus.getText());
        labor.setWeight(txtWeight.getText());
        labor.setSalaryGrade((cmbSalaryGrade.getSelectedItem()).toString());

        if (laborBO.addLabor(labor)) {
            JOptionPane.showMessageDialog(this, "Insert Succesfull!");
        } else {
            JOptionPane.showMessageDialog(this, "Insert False!");
        }


        if (common.compareDate(jdcStartDate.getDate(), jdcEndDate.getDate())) {
            for (int i = 0; i < common.dayBetween2Dates(jdcStartDate.getDate(), jdcEndDate.getDate()); i++) {
                attendance.setLaborID(txtLaborID.getText());
                attendance.setDailyAttendance(true);
                attendance.setExtraShift(Integer.parseInt(txtExtraShift.getText()));
                attendance.setShiftID(cmbShift.getSelectedItem().toString());
                attendance.setDay(common.upDate(jdcStartDate.getCalendar(), i));
                attendance.setSalaryDaily(atBO.calculateSalaryDaily(Integer.parseInt(txtExtraShift.getText()),
                        atBO.getSalaryPerHour(cmbSalaryGrade.getSelectedItem().toString()), 8));

                atBO.addAttendance(attendance);
            }
        } else {
            JOptionPane.showMessageDialog(this, "StartDate and EndDate is False!");
        }

    }//GEN-LAST:event_btnInsertActionPerformed

    private void btnSalaryDetailActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSalaryDetailActionPerformed
        // TODO add your handling code here:
        SalaryDetail salaryDetail = new SalaryDetail(null, true);
        salaryDetail.setVisible(true);
    }//GEN-LAST:event_btnSalaryDetailActionPerformed

    private void btnShiftDetailActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnShiftDetailActionPerformed
        // TODO add your handling code here:
        ShiftDetail shiftDetail = new ShiftDetail(null, true);
        shiftDetail.setVisible(true);
    }//GEN-LAST:event_btnShiftDetailActionPerformed

    private void btnResetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnResetActionPerformed
        // TODO add your handling code here:
        txtAddress.setText(null);
        txtBuilding.setText(null);
        txtExperience.setText(null);
        txtExtraShift.setText(null);
        txtFamilyDetail.setText(null);
        txtHeight.setText(null);
        txtLaborID.setText(null);
        txtName.setText(null);
        txtPersonRefer.setText(null);
        txtPhone.setText(null);
        txtStatus.setText(null);
        txtWeight.setText(null);
        rbnMale.setSelected(false);
        cbxPermanent.setSelected(false);
        cmbSalaryGrade.setSelectedItem(null);
        cmbShift.setSelectedItem(null);
        jdcStartDate.setCalendar(null);
        jdcEndDate.setCalendar(null);
    }//GEN-LAST:event_btnResetActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnInsert;
    private javax.swing.JButton btnReset;
    private javax.swing.JButton btnSalaryDetail;
    private javax.swing.JButton btnShiftDetail;
    private javax.swing.JButton btnView;
    private javax.swing.JCheckBox cbxPermanent;
    private javax.swing.JComboBox cmbSalaryGrade;
    private javax.swing.JComboBox cmbShift;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private com.toedter.calendar.JDateChooser jdcEndDate;
    private com.toedter.calendar.JDateChooser jdcStartDate;
    private javax.swing.JPanel jpnLeft;
    private javax.swing.JPanel jpnRight;
    private javax.swing.JLabel lblAddress;
    private javax.swing.JLabel lblEndDate;
    private javax.swing.JLabel lblExperience;
    private javax.swing.JLabel lblExtraShift;
    private javax.swing.JLabel lblGender;
    private javax.swing.JLabel lblHeight;
    private javax.swing.JLabel lblHour;
    private javax.swing.JLabel lblKg;
    private javax.swing.JLabel lblLaborID;
    private javax.swing.JLabel lblName;
    private javax.swing.JLabel lblPermanent;
    private javax.swing.JLabel lblPersonRefer;
    private javax.swing.JLabel lblPhone;
    private javax.swing.JLabel lblSalaryGrade;
    private javax.swing.JLabel lblShift;
    private javax.swing.JLabel lblStartDate;
    private javax.swing.JLabel lblStatus;
    private javax.swing.JLabel lblWeight;
    private javax.swing.JLabel lblm;
    private javax.swing.JRadioButton rbnMale;
    private javax.swing.JTextField txtAddress;
    private javax.swing.JTextArea txtBuilding;
    private javax.swing.JTextField txtExperience;
    private javax.swing.JTextField txtExtraShift;
    private javax.swing.JTextArea txtFamilyDetail;
    private javax.swing.JTextField txtHeight;
    private javax.swing.JTextField txtLaborID;
    private javax.swing.JTextField txtName;
    private javax.swing.JTextField txtPersonRefer;
    private javax.swing.JTextField txtPhone;
    private javax.swing.JTextField txtStatus;
    private javax.swing.JTextField txtWeight;
    // End of variables declaration//GEN-END:variables
}
